package com.hs.service.impl;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.hs.entity.Center;
import com.hs.mapper.CenterMapper;
import com.hs.service.CenterService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.Arrays;
import java.util.List;

/**
 * @ClassName CenterServiceImpl
 * @Description TODO
 * @Author qiuye
 * @Date 2025年07月31日 18:59
 * @Version 1.0
 */
@Service
public class CenterServiceImpl implements CenterService {
    @Autowired
    private CenterMapper centerMapper;
    @Override
    public int add(Center center) {
        return centerMapper.add(center);
    }

    @Override
    public int deteleByid(int id) {
        return centerMapper.deteleByid(id);
    }

    @Override
    public int update(Center center) {
        return centerMapper.update(center);
    }

    @Override
    public PageInfo<Center> selectByName(Center center, int pageNum, int pageSize) {
        PageHelper.startPage(pageNum, pageSize);
        List<Center> centers = centerMapper.selectByName(center);
        PageInfo<Center> pageInfo = new PageInfo<>(centers);
        return pageInfo;
    }

    @Override
    public Center selectById(int id) {
        return centerMapper.selectById(id);
    }

    @Override
    public int deleteByIds(Integer[] ids) {
        return centerMapper.deleteByIds(Arrays.asList(ids));
    }
}
